package ThreadDemo.ThreadSecure;

public class SynchronizedMethodThread extends Thread {

    private SynchronizedAccount synchronizedAccount;
    private double drawAmount;
    private String name;

    public SynchronizedMethodThread(SynchronizedAccount synchronizedAccount, double drawAmount, String name) {
        this.synchronizedAccount = synchronizedAccount;
        this.drawAmount = drawAmount;
        this.name = name;
    }

    public void run() {
        synchronizedAccount.draw(drawAmount);
    }

    public SynchronizedAccount getSynchronizedAccount() {
        return synchronizedAccount;
    }

    public void setSynchronizedAccount(SynchronizedAccount synchronizedAccount) {
        this.synchronizedAccount = synchronizedAccount;
    }

    public double getDrawAmount() {
        return drawAmount;
    }

    public void setDrawAmount(double drawAmount) {
        this.drawAmount = drawAmount;
    }


}
